package com.demohomework.homeworkdemo.mapper;

import com.demohomework.homeworkdemo.pojo.Notice;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface NoticeMapper {

    @Insert("insert into notice(title, info, create_at,update_at) values(#{title},#{info},now(),now())")
    void add(Notice notice);

    @Select("select * from notice")
    List<Notice> list();

    @Select("select * from notice where id = #{id}")
    Notice findId(Integer id);

    @Update("update notice set title = #{title}, info = #{info}, update_at = now() where id = #{id}")
    void update(Notice notice);

    @Delete("delete from notice where id = #{id}")
    void delete(Integer id);
}
